package com.example.demo.controller;


import com.example.demo.model.UserInfo;
import com.example.demo.service.UserService;
import jakarta.servlet.http.HttpSession;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/user")

public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public boolean login(String userName, String password, HttpSession session){
        //参数输入,打印日志
        log.info("接收到参数: " + userName);
        Boolean result = userService.checkUserAndPassword(userName, password, session);

        log.info("用户登入结果: name:{}, password:{}, 结果: {}", userName,password , result);
        return result;
    }
}
